<template>
  <t-image-viewer v-if="!store.isMobileType" v-model:visible="ImgVisible" :images="[urls + props.info.value]">
  </t-image-viewer>
  <van-image-preview :show-index="false" v-else v-model:show="ImgVisible" :images="[urls + props.info.value]">
  </van-image-preview>
  <div class="outline-parent jy-style-height border-hover-style outline-style2">
    <t-popup
      class="placement bottom center"
      attach="#attach"
      content="查看本单元全景展厅"
      placement="bottom"
      showArrow
      destroyOnClose
      :disabled="store.isMobileType ? true : false"
    >
      <img
        v-if="props.info.digitalShowroom"
        class="icon-3d blinking-animation-style"
        id="outlineIcon"
        @click="open(props.info.digitalShowroom)"
        :src="publicUrls + 'free/style4/3dIcon.png'"
      />
    </t-popup>
    <img
      class="outline-parent-bg"
      v-if="props.info.subTitle || props.info.value || props.info.remarks"
      :src="publicUrls + 'free/style4/Level1outlineStyle2Bg.webp'"
      alt=""
    />
    <img class="outline-parent-bg" v-else :src="publicUrls + 'free/style4/Level1outlineStyle2Bg2.webp'" alt="" />
    <div
      class="outline jy-style-height"
      :style="!props.info.subTitle && !props.info.value && !props.info.remarks && { justifyContent: 'center' }"
    >
      <div
        class="content-tiitle"
        v-html="textType(props.info.text)"
        v-if="props.info.subTitle || props.info.value || props.info.remarks"
      ></div>
      <div class="content-tiitle2" v-else>
        {{ props.info.text }}
      </div>

      <div
        class="outline-content"
        v-if="props.info.subTitle || props.info.value || props.info.remarks"
        :style="!props.info.subTitle && { justifyContent: 'center' }"
      >
        <p class="outline-subTitle" v-if="props.info.subTitle">——{{ props.info.subTitle }}</p>
        <div class="cover" v-if="props.info.value" :style="!props.info.remarks && { marginBottom: '0px' }">
          <img
            class="outline-cover"
            @click="ImgVisible = true"
            :src="urls + props.info.value + '?imageView2/3/format/webp'"
            alt=""
          />
        </div>
        <TextMax
          :data="props.info.remarks"
          :infoData="props.info"
          :title="props.info.text"
          :row="props.info.value ? 3 : !props.info.subTitle ? 5 : 8"
        ></TextMax>
      </div>
    </div>
    <img class="shadow" :src="publicUrls + 'free/style4/firstLevelOutline1Shadow.png?imageView2/3/format/webp'" alt="" />
  </div>
</template> 

<script lang="ts">
export default defineComponent({
  name: 'free4Style2',
});
</script>

<script setup lang="ts">
import { publicUrls, textType } from '@/utils/minxin';
import { getTextHtml } from '@/utils/minxin';
import { urls } from '@/utils/request/upload';
import { defineComponent, ref } from 'vue';
import TextMax from '@/freeComponents/textMode/TextMax.vue';
import { useProjectStore } from '@/store';
import { transform } from 'lodash';

const ImgVisible = ref(false);
const store = useProjectStore();

const props = defineProps({
  info: {
    type: Object,
  },
});

// 跳转全景链接
const open = (url: any) => {
  if (url) {
    window.open(url, '_blank');
  }
};
</script>

<style scoped lang="less">
.outline-parent {
  position: relative;
  margin-right: 90px;
  margin-top: 0;
  margin-left: 120px;
  .shadow {
    width: 820px;
    height: 254px;
    position: absolute;
    bottom: 0;
    left: 0;
  }
  .icon-3d {
    width: 37px;
    height: 47px;
    object-fit: contain;
    position: absolute;
    top: -6px;
    right: 70px;
    z-index: 21;
  }
}
.outline-parent-bg {
  width: 620px;
  height: 100%;
  position: relative;
  z-index: 20;
}
.outline {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  flex-direction: column;
  justify-content: space-between;
  width: 100%;
  padding: 16px 0 106px 0;
}
.content-tiitle {
  width: 244px;
  height: 288px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  margin-top: 8px;
  ::v-deep p {
    height: 100%;
    writing-mode: vertical-rl;
    text-orientation: upright;
    letter-spacing: 4px;
    color: #5391a3;
    text-align: center;
    font-family: 'SourceHanSerifCN-Bold';
    font-size: 32px;
    line-height: 36px;
    text-shadow: 1.6px 1.6px 1px #bbd3d3;
    padding: 0 28px;
    position: relative;
    &::after {
      content: '';
      width: 3px;
      height: 100%;
      position: absolute;
      left: 0;
      top: 0;
      background: #5391a3;
      box-shadow: 1.6px 1.6px 1px 0 #bbd3d3;
    }
    &:last-child::before {
      content: '';
      width: 3px;
      height: 100%;
      position: absolute;
      right: 0;
      top: 0;
      background: #5391a3;
      box-shadow: 1.6px 1.6px 1px 0 #bbd3d3;
    }
  }
}
.content-tiitle2 {
  display: flex;
  align-items: center;
  justify-content: center;
  writing-mode: vertical-rl;
  text-orientation: upright;
  letter-spacing: 4px;
  color: #5391a3;
  text-align: center;
  font-family: 'SourceHanSerifCN-Bold';
  font-size: 32px;
  line-height: 36px;
  text-shadow: 1.6px 1.6px 1px #bbd3d3;
  position: relative;
  padding: 0 28px;
  &::after {
    content: '';
    width: 3px;
    height: 100%;
    position: absolute;
    left: 0;
    top: 0;
    background: #5391a3;
    box-shadow: 1.6px 1.6px 1px 0 #bbd3d3;
  }
  &::before {
    content: '';
    width: 3px;
    height: 100%;
    position: absolute;
    right: 0;
    top: 0;
    background: #5391a3;
    box-shadow: 1.6px 1.6px 1px 0 #bbd3d3;
  }
}

.outline-content {
  width: 380px;
  height: 330px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  margin-top: 410px;
  .outline-subTitle {
    color: #333;
    text-align: center;
    font-family: 'SourceHanSerifCN';
    font-size: 18px;
    line-height: 28px;
    margin-bottom: 16px;
  }
  .cover {
    display: flex;
    align-items: center;
    width: 100%;
    // height: 160px;
    flex: 1;
    position: relative;
    overflow: hidden;
    margin-bottom: 16px;
    border: 3px solid #d5eaea;
    padding: 4px;
    img {
      width: 100%;
      height: 100%;
      object-fit: contain;
      background: #e1f2f2;
      border: 1px solid #d5eaea;
    }
  }
}

::v-deep .textMore-box {
  flex-shrink: 0;
}
::v-deep .van-text-ellipsis {
  font-family: PingFangSC !important;
  font-size: 16px !important;
  color: #333 !important;
  line-height: 32px !important;
}
::v-deep .van-text-ellipsis__action::before {
  color: #83b0b3 !important;
  font-weight: 400 !important;
  text-decoration-line: underline;
}
::v-deep .t-popup__content {
  background: #bcd5d5;
  box-shadow: none;
  padding: 0 10px;
  line-height: 20px;
  color: #fcffff;
}
::v-deep .t-popup__arrow::before {
  background: #bcd5d5;
  border: none;
  box-shadow: none !important;
}
</style>